<?php


if ( isset($_GET["email"])  && isset($_GET["senha"]) && isset($_GET["confsenha"]) && isset($_GET["sexo"]) && isset($_GET["dtnasc"]) ){
				$email = $_GET["email"];
				$senha = $_GET["senha"];
    			      $confsenha = $_GET["confsenha"];
			      $sexo = $_GET["sexo"];
			      $dtnasc = $_GET["dtnasc"];

				$result = cadastro( $email, $senha, $confsenha, $sexo, $dtnasc );
				echo $result;
				}






function makeSqlConnection()
{
$DB_HostName = "localhost";
$DB_Name = "ios";
$DB_User = "root";
$DB_Pass = "root";

	$con = mysql_connect($DB_HostName,$DB_User,$DB_Pass) or die(mysql_error()); 

		mysql_select_db($DB_Name,$con) or die(mysql_error()); 

	return $con;
}

function disconnectSqlConnection($con)
{
	mysql_close($con);
}

function cadastro($email, $senha, $confsenha, $sexo, $dtnasc )
{
	//require (FILE);
	$con = makeSqlConnection();
	
	$sql = "INSERT INTO tb_login(email,senha,confsenha,sexo,dtnasc ) VALUES('$email', '$senha', '$confsenha', '$sexo','$dtnasc')";

	$res = mysql_query($sql,$con) or die(mysql_error());

       echo "sql  = $sql";
	
	$res1 = mysql_affected_rows();

       echo "res1  = $res1";

	disconnectSqlConnection($con);
	
	 if ($res1 != 0) {
		return 1;
	}else{
		return 0;
	}// end else
	
	
}// end of Function 

?>